# encoding: utf-8
require 'json'
require File.expand_path('../models/Isgoods', File.dirname(__FILE__))
class MM_IsGood < Controller
  def setisgood
    callback=@params[:callback]
    g=@params[:gid]
    s=@params[:is]
    d=Isgoods.find_by(gid:g)
    if d==nil then
    c=Isgoods.new
    c.gid=g
    c.isgoods=s
    c.save
    callback+"([{'isg':'sa'}])"
    else
    d.isgoods=s
    d.save
    callback+"([{'isg':'up'}])"
    end


  end
  def showisgood
    callback=@params[:callback]
    s=Isgoods.all

    callback+"("+s.to_json+")"
  end
end